Redirect legacy Dev Wiki /code.ext imports to .ext#16235
Redirect legacy Dev Wiki /code.ext imports to .ext#16235
Conversation
mszabo-wikia
left a comment
There was a problem hiding this comment.
might be worth to add a test for the logic:
- it entails adding both the file housing the code to be tested + the test file to https://github.com/Wikia/app/blob/dev/tests/karma/js-unit.conf.js
- existing tests like https://github.com/Wikia/app/blob/dev/extensions/wikia/GlobalShortcuts/scripts/spec/PageActions.spec.js can be an inspiration
- tests can be run by running
npm test(after fetching the dependencies)
…lesheet URLs and respect wgScriptPath in their imports as well
There was a problem hiding this comment.
@mszabo-wikia I added tests now (based on BannerNotifications.spec.js), does it look okay and should I cover more code in it?
| }; | ||
|
|
||
| // Special stylesheet links for Monobook only (see bug 14717) | ||
| var skinpath = mw.config.get( 'stylepath' ) + '/' + mw.config.get( 'skin' ); |
There was a problem hiding this comment.
These aren't used anymore and don't seem like they will cause issues for custom scripts.
| return false; | ||
| } | ||
|
|
||
| if (skin != 'monaco' && skin != 'oasis') { |
There was a problem hiding this comment.
This never executes anymore.
skins/common/wikibits.js
Outdated
| // Check protocol-relative, HTTP and HTTPS versions of Dev Wiki links | ||
| // This is done via wgWikiaBaseDomain so fandom.com migration does | ||
| // not affect it and can't use wgWikiaBaseDomainRegex so it does | ||
| // not potentially affect devbox URLs such as dev.wikia-dev.pl |
There was a problem hiding this comment.
Any ideas for smarter implementation of this? Will using wgWikiaBaseDomain still be an issue after the fandom.com migration?
There was a problem hiding this comment.
I would consider using wgWikiaBaseDomainRegex instead to cover both domains.
There was a problem hiding this comment.
That will also cover URLs like dev.wikia-dev.pl. Is that an issue?
There was a problem hiding this comment.
Nope, that's fine, makes it easier to have the same behaviour in our development environment too. :)
| describe('wikibits', function() { | ||
| 'use strict'; | ||
| mw.config = new mw.Map(); | ||
| var url1 = '/index.php?title=MediaWiki:UserTags/code.js&action=raw&ctype=text/javascript'; |
There was a problem hiding this comment.
Is there any smarter way of storing all these URLs?
There was a problem hiding this comment.
Generally I wouldn't store them using names url1, url2 etc..., those names lack context and they should be at least named according to what they store. Going further maybe a good idea would be to set a map like:
{
'UserTagsCodeJsRelative': {
'CodePartRemoved': '....',
'CodePartRemovedWithDomain':'....'
}
}
Using those keys should be easier to read and there would be no need to look for the values.
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
Couple months late, but public note of technical blockers:
|
| var url1expect = '/index.php?title=MediaWiki:UserTags.js&action=raw&ctype=text/javascript'; | ||
| var url1expect2 = '//dev.wikia.com/index.php?title=MediaWiki:UserTags.js&action=raw&ctype=text/javascript'; | ||
| var url2 = '/index.php?title=User:TK-999/common.js&action=raw&ctype=text/javascript'; | ||
| var url3 = 'http://dev.wikia.com/index.php?title=MediaWiki:UserTags/code.js&action=raw&ctype=text/javascript'; |
There was a problem hiding this comment.
dev.wikia.com is moved to dev.fandom.com, also fandom.com works on https
| var url3 = 'http://dev.wikia.com/index.php?title=MediaWiki:UserTags/code.js&action=raw&ctype=text/javascript'; | |
| var url3 = 'https://dev.fandom.com/index.php?title=MediaWiki:UserTags/code.js&action=raw&ctype=text/javascript'; |
| mw.config = new mw.Map(); | ||
| var url1 = '/index.php?title=MediaWiki:UserTags/code.js&action=raw&ctype=text/javascript'; | ||
| var url1expect = '/index.php?title=MediaWiki:UserTags.js&action=raw&ctype=text/javascript'; | ||
| var url1expect2 = '//dev.wikia.com/index.php?title=MediaWiki:UserTags.js&action=raw&ctype=text/javascript'; |
There was a problem hiding this comment.
| var url1expect2 = '//dev.wikia.com/index.php?title=MediaWiki:UserTags.js&action=raw&ctype=text/javascript'; | |
| var url1expect2 = '//dev.fandom.com/index.php?title=MediaWiki:UserTags.js&action=raw&ctype=text/javascript'; |
| var url1expect2 = '//dev.wikia.com/index.php?title=MediaWiki:UserTags.js&action=raw&ctype=text/javascript'; | ||
| var url2 = '/index.php?title=User:TK-999/common.js&action=raw&ctype=text/javascript'; | ||
| var url3 = 'http://dev.wikia.com/index.php?title=MediaWiki:UserTags/code.js&action=raw&ctype=text/javascript'; | ||
| var url3expect = '//dev.wikia.com/index.php?title=MediaWiki:UserTags/code.js&action=raw&ctype=text/javascript'; |
There was a problem hiding this comment.
| var url3expect = '//dev.wikia.com/index.php?title=MediaWiki:UserTags/code.js&action=raw&ctype=text/javascript'; | |
| var url3expect = '//dev.fandom.com/index.php?title=MediaWiki:UserTags/code.js&action=raw&ctype=text/javascript'; |
| var url2 = '/index.php?title=User:TK-999/common.js&action=raw&ctype=text/javascript'; | ||
| var url3 = 'http://dev.wikia.com/index.php?title=MediaWiki:UserTags/code.js&action=raw&ctype=text/javascript'; | ||
| var url3expect = '//dev.wikia.com/index.php?title=MediaWiki:UserTags/code.js&action=raw&ctype=text/javascript'; | ||
| var url4 = 'https://dev.wikia.com/index.php?title=MediaWiki:UserTags/code.js&action=raw&ctype=text/javascript'; |
There was a problem hiding this comment.
| var url4 = 'https://dev.wikia.com/index.php?title=MediaWiki:UserTags/code.js&action=raw&ctype=text/javascript'; | |
| var url4 = 'https://dev.fandom.com/index.php?title=MediaWiki:UserTags/code.js&action=raw&ctype=text/javascript'; |
| var url5 = 'http://platform.twitter.com/widgets.js'; | ||
| var url6 = '/index.php?title=MediaWiki:WikiaNavigationBarStyle/code.css&action=raw&ctype=text/css'; | ||
| var url6expect = '/index.php?title=MediaWiki:WikiaNavigationBarStyle.css&action=raw&ctype=text/css'; | ||
| var url7 = 'http://dev.wikia.com/index.php?title=MediaWiki:WikiaNavigationBarStyle/code.css&action=raw&ctype=text/css'; |
There was a problem hiding this comment.
| var url7 = 'http://dev.wikia.com/index.php?title=MediaWiki:WikiaNavigationBarStyle/code.css&action=raw&ctype=text/css'; | |
| var url7 = 'https://dev.fandom.com/index.php?title=MediaWiki:WikiaNavigationBarStyle/code.css&action=raw&ctype=text/css'; |
| var url7expect = '//dev.wikia.com/index.php?title=MediaWiki:WikiaNavigationBarStyle/code.css&action=raw&ctype=text/css'; | ||
| var url7expect2 = '//dev.wikia.com/index.php?title=MediaWiki:WikiaNavigationBarStyle.css&action=raw&ctype=text/css'; | ||
| var url8 = 'http://platform.twitter.com/widgets.css'; | ||
| var url9 = '//kocka.wikia.com/index.php?title=MediaWiki:UncategorizedFileListing/code.js&action=raw&ctype=text/javascript'; |
There was a problem hiding this comment.
| var url9 = '//kocka.wikia.com/index.php?title=MediaWiki:UncategorizedFileListing/code.js&action=raw&ctype=text/javascript'; | |
| var url9 = '//kocka.fandom.com/index.php?title=MediaWiki:UncategorizedFileListing/code.js&action=raw&ctype=text/javascript'; |
| describe('wikibits', function() { | ||
| 'use strict'; | ||
| mw.config = new mw.Map(); | ||
| var url1 = '/index.php?title=MediaWiki:UserTags/code.js&action=raw&ctype=text/javascript'; |
There was a problem hiding this comment.
Generally I wouldn't store them using names url1, url2 etc..., those names lack context and they should be at least named according to what they store. Going further maybe a good idea would be to set a map like:
{
'UserTagsCodeJsRelative': {
'CodePartRemoved': '....',
'CodePartRemovedWithDomain':'....'
}
}
Using those keys should be easier to read and there would be no need to look for the values.
| /*global describe, it, expect*/ | ||
| describe('wikibits', function() { | ||
| 'use strict'; | ||
| mw.config = new mw.Map(); |
There was a problem hiding this comment.
I think that it is reset everywhere like in line :40 , so it's not needed
| window.importStylesheetURI = function( url, media ) { | ||
| var l = document.createElement( 'link' ); | ||
| window.importStylesheetURI = function(url, media) { | ||
| var l = document.createElement('link'); |
| l.rel = 'stylesheet'; | ||
| l.href = maybeMakeProtocolRelative(url); | ||
| if( media ) { | ||
| if (media) { |
There was a problem hiding this comment.
I think spaces should be left alone as they were
Per Slack conversation with @Grunny & @KockaAdmiralac. Also prevents hardcoding of $wgScript in importScriptPage function.